<script setup lang="ts">
import searchTab from '../components/searchTab.vue';
import { ref } from 'vue';
import { Toast } from 'vant';
import { useRouter } from 'vue-router';
const router = useRouter()
let value = ref<string>('');
const onSearch = (val: string) => Toast(val);
const onCancel = () => {
    router.go(-1)
}
</script>

<template>
    <div class="searchContainer">
        <van-search
            v-model="value"
            show-action
            placeholder="在这里写下你想寻找的"
            @search="onSearch"
            @cancel="onCancel"
        />
    </div>
    <div v-if="!value">
        <div class="search-history"></div>
        <div class="search-hot"></div>
    </div>

    <div class="search-result" v-else>
        <search-tab :value="value"/>
    </div>
</template>

<style>
</style>